﻿//--------------------------------------------------------------------------
// 
//  Copyright (c) Chili Software.  All rights reserved. 
// 
//  File: RelatedPropertiesPair.cs
//
//  Description: Relation between two member of the persistent object.
// 
//--------------------------------------------------------------------------

using System;

namespace Chili.Opf3.Mapping
{
	/// <summary>
	/// Specifies the relation between two properties of two objects.
	/// </summary>
	internal sealed class RelatedPropertiesPair : IRelatedPropertiesPair
	{
		private IMemberInfo _parentMember;
		private IMemberInfo _childMember;
		
		/// <summary>
		/// Creates a new instance of the <see cref="RelatedPropertiesPair">RelatedPropertiesPair Class</see>.
		/// </summary>
		/// <param name="parentMember">The object member in the parent class.</param>
		/// <param name="childMember">The object member in the child class.</param>
		internal RelatedPropertiesPair(IMemberInfo parentMember, IMemberInfo childMember)
		{
			if (parentMember == null)
				throw new ArgumentNullException("parentMember");
			if (childMember == null)
				throw new ArgumentNullException("childMember");

			_parentMember = parentMember;
			_childMember = childMember;
		}

		/// <summary>
		/// Returns the object member of the parent class.
		/// </summary>
		public IMemberInfo ParentMember
		{
			get { return _parentMember; }
		}

		/// <summary>
		/// Returns the object member of the child class.
		/// </summary>
		public IMemberInfo ChildMember
		{
			get { return _childMember; }
		}
	}
}
